package cn.zhangyong.opengl30learn

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import cn.zhangyong.opengl30learn.baselearnbackgroud1.Background1Activity
import cn.zhangyong.opengl30learn.baselearnshape2.ColorfulTriangleActivity
import cn.zhangyong.opengl30learn.baselearnshape2.RectangleActivity
import cn.zhangyong.opengl30learn.baselearnshape2.ShapeActivity
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        btn_base_1.setOnClickListener {
            navigateTo(Background1Activity::class.java)
        }
        btn_base_2.setOnClickListener {
            navigateTo(ShapeActivity::class.java)
        }

        btn_base_3.setOnClickListener {
            navigateTo(ColorfulTriangleActivity::class.java)
        }
        btn_base_4.setOnClickListener {
            navigateTo(RectangleActivity::class.java)
        }
    }

    private fun navigateTo(clazz: Class<out AppCompatActivity>) {
        startActivity(Intent(this, clazz))
    }

}
